From 6fe9264bfd11d1eb3e9e6140566e4fc0315cde71 Mon Sep 17 00:00:00 2001 From: Gabriel Souza Franco Date: Fri, 30 Jan 2015 12:38:21 -0200 Subject: [PATCH] =?utf8?q?Writer::write=20=E2=86=92=20Writer::write=5Fall?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cargo/core/shell.rs | 10 +++++----- src/cargo/ops/cargo_new.rs | 4 ++-- src/cargo/ops/cargo_rustc/fingerprint.rs | 6 +++--- src/cargo/sources/registry.rs | 2 +- src/cargo/util/config.rs | 2 +- tests/test_cargo_build_auth.rs | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/cargo/core/shell.rs b/src/cargo/core/shell.rs index b39861945..c0a62baaf 100644 --- a/src/cargo/core/shell.rs +++ b/src/cargo/core/shell.rs @@ -171,10 +171,10 @@ impl Shell { } impl Writer for Shell { - fn write(&mut self, buf: &[u8]) -> IoResult<()> { + fn write_all(&mut self, buf: &[u8]) -> IoResult<()> { match self.terminal { - Colored(ref mut c) => c.write(buf), - NoColor(ref mut n) => n.write(buf) + Colored(ref mut c) => c.write_all(buf), + NoColor(ref mut n) => n.write_all(buf) } } @@ -187,7 +187,7 @@ impl Writer for Shell { } impl Writer for UghWhyIsThisNecessary { - fn write(&mut self, bytes: &[u8]) -> IoResult<()> { - self.inner.write(bytes) + fn write_all(&mut self, bytes: &[u8]) -> IoResult<()> { + self.inner.write_all(bytes) } } diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 3126e4083..85ab012c7 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -80,11 +80,11 @@ fn mk(config: &Config, path: &Path, name: &str, match vcs { VersionControl::Git => { try!(GitRepo::init(path)); - try!(File::create(&path.join(".gitignore")).write(ignore.as_bytes())); + try!(File::create(&path.join(".gitignore")).write_all(ignore.as_bytes())); }, VersionControl::Hg => { try!(HgRepo::init(path)); - try!(File::create(&path.join(".hgignore")).write(ignore.as_bytes())); + try!(File::create(&path.join(".hgignore")).write_all(ignore.as_bytes())); }, VersionControl::NoVcs => { try!(fs::mkdir(path, old_io::USER_RWX)); diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index f94316f29..96d8ed99d 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -409,8 +409,8 @@ pub fn append_current_dir(path: &Path, cwd: &Path) -> CargoResult<()> { let mut f = try!(File::open_mode(path, old_io::Open, old_io::ReadWrite)); let contents = try!(f.read_to_end()); try!(f.seek(0, old_io::SeekSet)); - try!(f.write(cwd.as_vec())); - try!(f.write(&[0])); - try!(f.write(&contents[])); + try!(f.write_all(cwd.as_vec())); + try!(f.write_all(&[0])); + try!(f.write_all(&contents[])); Ok(()) } diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index f17aaf772..ef41471cd 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -333,7 +333,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> { pkg))) } - try!(File::create(&dst).write(resp.get_body())); + try!(File::create(&dst).write_all(resp.get_body())); Ok(dst) } diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 5393ca909..5f5800140 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -436,6 +436,6 @@ pub fn set_config(cfg: &Config, loc: Location, key: &str, let contents = File::open(&file).read_to_string().unwrap_or("".to_string()); let mut toml = try!(cargo_toml::parse(contents.as_slice(), &file)); toml.insert(key.to_string(), value.into_toml()); - try!(File::create(&file).write(toml::Value::Table(toml).to_string().as_bytes())); + try!(File::create(&file).write_all(toml::Value::Table(toml).to_string().as_bytes())); Ok(()) } diff --git a/tests/test_cargo_build_auth.rs b/tests/test_cargo_build_auth.rs index 08592b77a..646db4fd8 100644 --- a/tests/test_cargo_build_auth.rs +++ b/tests/test_cargo_build_auth.rs @@ -41,7 +41,7 @@ test!(http_auth_offered { let t = Thread::scoped(move|| { let mut s = BufferedStream::new(a.accept().unwrap()); let req = headers(&mut s); - s.write(b"\ + s.write_all(b"\ HTTP/1.1 401 Unauthorized\r\n\ WWW-Authenticate: Basic realm=\"wheee\"\r\n \r\n\ @@ -55,7 +55,7 @@ test!(http_auth_offered { let mut s = BufferedStream::new(a.accept().unwrap()); let req = headers(&mut s); - s.write(b"\ + s.write_all(b"\ HTTP/1.1 401 Unauthorized\r\n\ WWW-Authenticate: Basic realm=\"wheee\"\r\n \r\n\ -- 2.30.2